<?php
/**
 * 
 * @author nunenuh
 *
 */
class Talker extends Connector{
	private $debug = false;
	private $sender;
	private $reciever;
//        private $param;


        public function  __construct($host, $port, $username, $password){            
        parent::__construct($host, $port, $username, $password);
//         parent::__construct(Yii::app()->params['address'], Yii::app()->params['port'], Yii::app()->params['username'], Yii::app()->params['password']);
		parent::connect();
		$this->sender 	= new TalkerSender($this);
		$this->reciever = new TalkerReciever($this);	
	}
	
	public function isLogin(){
		return parent::isLogin();
	}
	
	public function isConnected(){
		return parent::isConnected();
	}
	
	public function isDebug(){
		return $this->debug;
	}
	
	public function setDebug($boolean){
		$this->debug = $boolean;
		$this->sender->setDebug($boolean);
		$this->reciever->setDebug($boolean);
	}
	
	public function isTrap(){
		return $this->reciever->isTrap();
	}
	
	public function isDone(){
		return $this->reciever->isDone();
	}
	
	public function isData(){
		return $this->reciever->isData();
	}
	
	public function send($sentence){
		$this->sender->send($sentence);
		$this->reciever->doRecieving();
	}
	
	public function getResult(){
		return $this->reciever->getResult();
	}
	
}